<?php
/**
 * index.php
 * time 2020/11/10 23:22
 * author zrone <xujining415@gmail.com>
 * copyright zrone <xujining415@gmail.com>
 */

require_once "services/CheckDomainService.php";
require_once "services/SaveContactTemplateService.php";
require_once "services/SaveContactTemplateCredentialService.php";
require_once "services/QueryContactTemplateService.php";
require_once "services/CreateOrderService.php";
require_once "services/QueryOrderService.php";
require_once "services/SendMailService.php";

$binds = [
    "0" => [
        "key" => "7Bhk03",
        "subject" => "文件翻译估价完成",
        "params" => [],
    ],
    "1" => [
        "key" => "DQaRn1",
        "subject" => "雇佣邀请失败",
        "params" => [],
    ],
    "2" => [
        "key" => "UcA394",
        "subject" => "服务预订雇佣邀请",
        "params" => [],
    ],
    "3" => [
        "key" => "oRdxu1",
        "subject" => "服务预订雇佣邀请成功",
        "params" => [],
    ],
    "4" => [
        "key" => "As8zF2",
        "subject" => "文件翻译完成",
        "params" => [],
    ],
    "5" => [
        "key" => "eFtJ03",
        "subject" => "简历翻译完成",
        "params" => [],
    ],
    "6" => [
        "key" => "ngjm6",
        "subject" => "共脉网邮箱验证",
        "params" => [],
    ],
    "7" => [
        "key" => "QSGP61",
        "subject" => "注册账户",
        "params" => [],
    ],
    "8" => [
        "key" => "OJsW4",
        "subject" => "注册账户",
        "params" => [],
    ],
    "9" => [
        "key" => "Mt3Q12",
        "subject" => "修改账户",
        "params" => [],
    ],
    "10" => [
        "key" => "egWpT2",
        "subject" => "Bind Email",
        "params" => [],
    ],
    "11" => [
        "key" => "0ZY4H2",
        "params" => [],
        "subject" => "电子发票已开具",
    ]
];

$SendMailService = new SendMailService;
echo $SendMailService($binds[0]);

//$action = $_GET['action'];
//switch ($action) {
//    case 'CheckDomain':
//        // 检查域名是否可用
//        $CheckDomainService = new CheckDomainService;
//        echo $CheckDomainService($_GET['domain']);
//        break;
//
//    case 'SaveContactTemplate':
//        // 保存联系人模板
//        $SaveContactTemplateService = new SaveContactTemplateService;
//
//        $logicData = [
//            "ContactTemplateId" => "",
//            "DefaultTemplate" => "FALSE",
//            "CName" => "姓名",
//            "EName" => "Xing Min",
//            "CCompany" => "姓名",
//            "ECompany" => "Xing Min",
//            "CCountry" => "CN",
//            "CProvince" => "安徽",
//            "EProvince" => "An Hui",
//            "CCity" => "合肥",
//            "ECity" => "He Fei",
//            "CVenu" => "三里庵",
//            "EVenu" => "San Li An",
//            "Email" => "email@postmaster.com",
//            "TelArea" => "86",
//            "PostalCode" => "230000",
//            "TelMain" => "18888888888",
//            "RegType" => "PERSONAL"
//        ];
//
//        echo $SaveContactTemplateService($logicData);
//        break;
//
//    case 'SaveContactTemplateCredential':
//        // 提交信息模板实名认证
//        $SaveContactTemplateCredentialService = new SaveContactTemplateCredentialService;
//        $logicData = [
//            "ContactTemplateId" => "SaveContactTemplate 返回的模板ID",
//            "CredentialNo" => "身份证号码/营业执照编号",
//            "Credential" => base64_encode(file_get_contents('credential.jpg')),
//        ];
//        echo $SaveContactTemplateCredentialService($logicData);
//        break;
//
//    case 'QueryContactTemplate':
//        // 查询信息模板
//        $QueryContactTemplateService = new QueryContactTemplateService;
////        $logicData = [
////            "CCompany" => "姓名",
////            "ECompany" => "Xing Min"
////        ];
//        $logicData = [];
//        echo $QueryContactTemplateService($logicData);
//        break;
//
//    case 'CreateOrder':
//        // 购买域名创建订单
//        $CreateOrderService = new CreateOrderService;
//        $subOrderParam = [
//            [
//                'Action' => 'activate',
//                'DomainTemplateID' => '模板信息ID新购必须',
//                'Period' => 12,
//                'RelatedName' => 'hzlanxin123000.com',
//            ]
//        ];
//        $logicData = [];
//        foreach ($subOrderParam as $key => $item) {
//            foreach ($item as $name => $props) {
//                $logicData['SubOrderParam.' . ($key + 1) . '.' . $name] = $props;
//            }
//        }
//        echo $CreateOrderService($logicData);
//        break;
//
//    case 'QueryOrder':
//        // 查询订单
//        $QueryOrderService = new QueryOrderService;
//        echo $QueryOrderService("订单编号");
//        break;
//}
//
//echo '<br/><a style="font-size: 25px;" href="index.html">返回</a>';